package utils;

import javax.servlet.http.Cookie;

public class CookieHandler {

	public static String getCookieValue(Cookie[] cookies, String cookieName) {
		for (int i = 0; i < cookies.length; i++) {
			Cookie cookie = cookies[i];
			if (cookieName.equals(cookie.getName()))
				return (cookie.getValue());
		}
		return null;
	}

	public static Cookie eraseCookie(String name) {
		Cookie c = new Cookie(name, null);
		c.setMaxAge(0);
		return c;
	}

}